<template>
    <div>
        <component :is="one"></component>

        <div id="container">
            <div id="content2">
                <table width="100%" height="21" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="15" height="15" align="left" valign="top">
                            <div align="left"></div>
                        </td>
                        <td width="385" align="left" valign="bottom" class="12">&nbsp;</td>
                    </tr>
                    <tr>
                        <td height="15" align="left" valign="top">&nbsp;</td>
                        <td height="15" align="left" valign="top" class="12">
                            <table width="100%" height="15" border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td height="20" align="center">
                                        <div class="right_proaducts">
                                            <div align="left">我的位置&gt;&gt;科技项目申报&gt;申请项目信息</div>
                                        </div>
                                        <!--      <form action="unit_index.html" method="post" id="form" onsubmit="return checkProjectDeclare(this)">-->
                                        <!-- <DIV class=padding>
                                            <DIV id=middlebody> -->
                                                <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                                    <tbody>
                                                        <tr>
                                                            <td>
                                                                <div align="left">
                                                                    |&nbsp;&nbsp;欢迎,单位用户&nbsp;&nbsp;|&nbsp;&nbsp;
                                                                    <a class="table_t"
                                                                        href="#/">注销      </a>&nbsp;&nbsp;|&nbsp;&nbsp;<a
                                                                        href="javascript:history.go(-1)">后退</a>&nbsp;&nbsp;|
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div align="center"><a
                                                                        href="#/unit/unitinfo">单位信息</a></div>
                                                            </td>
                                                            <td>
                                                                <div align="center"><a
                                                                        href="#/unit/reworkpassword">修改密码</a>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div align="center"><a
                                                                        href="#/unit/showprojectcategory">项目申报管理</a>
                                                                </div>
                                                            </td>
                                                            <td height="50">
                                                                <div align="center"><a
                                                                        href="#/unit/simplesearch">信息查询</a>
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                                <table id="app" width="60%" border="0" cellpadding="0" cellspacing="1">
                                                    <input type="hidden" value="4" name="categoryid" />
                                                    <input type="hidden" value="5" name="unitid" />
                                                    <tbody>
                                                        <tr>
                                                            <td width="126" align="right" bgcolor="#f3f3f3">项目分类名称</td>
                                                            <td width="10" align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">{{cname}}</div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">项目名称</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="projectname" name="projectname"
                                                                        v-model="project.projectName" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">申请单位</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="unitname2" v-model="username"
                                                                        name="unitname2" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">申请人</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="applicant" name="applicant"
                                                                        v-model="project.applicant" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">职称</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="grade" name="grade"
                                                                        v-model="project.grade" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">学历</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="education" name="education"
                                                                        v-model="project.education" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">申请时间</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="filldate" v-model="project.fillData"
                                                                        name="fillDate" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">项目现状</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="status" name="status"
                                                                        v-model="project.status" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">项目前景</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="future" name="future"
                                                                        v-model="project.future" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">重难点分析</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="analysis" name="analysis"
                                                                        v-model="project.analysis" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">研究方法</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="way" name="way" v-model="project.way" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">预计研究成果</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="result" name="result"
                                                                        v-model="project.result" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right" bgcolor="#f3f3f3">申请资金</td>
                                                            <td align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td colspan="2" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input id="capital" name="capital"
                                                                        v-model="project.capital" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" align="right" bgcolor="#f3f3f3">&nbsp;</td>
                                                            <td width="70" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input type="button" value="申请"
                                                                        @click="updateProject()" />
                                                                </div>
                                                            </td>
                                                            <td width="239" bgcolor="#f3f3f3">
                                                                <div align="left">
                                                                    <input name="reset" type="reset" value="重置" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                                <div></div>
                                                <!--              </form>-->
                                    </td>
                                </tr>
                            </table>
                            <br />
                            <div class="table_wz"></div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
        <component :is="two"></component>
    </div>
</template>
<script>
    import four from '../../util/four';
    import aaa from '@/components/header.vue'
    import bbb from '@/components/footer.vue'
    export default {
        components: {
            aaa, bbb
        },
        data() {
            return {
                one: 'aaa',
                two: 'bbb',
                username: "",
                cname: "",
                project: {
                    "projectName": "",
                    "categoryid": "",
                    "unitid": "",
                    "applicant": "",
                    "grade": "",
                    "education": "",
                    "fillData": "",
                    "status": "",
                    "future": "",
                    "analysis": "",
                    "way": "",
                    "result": "",
                    "capital": "",

                },
            }
        },
        mounted() {
            this.getMessage();
        },
        methods: {
            getMessage() {
                //获取pid
                this.project.categoryid = JSON.parse(sessionStorage.getItem("cid"));
                this.project.unitid = JSON.parse(sessionStorage.getItem("userid"));
                this.username = JSON.parse(sessionStorage.getItem("username"));
                this.cname = JSON.parse(sessionStorage.getItem("cname"));
            },
            updateProject() {
                four.post("/projectManage", this.project).then((res) => {
                    if (res.data.code == 20011) {
                        this.$message.success("申报成功！")
                    } else {
                        this.$message.error("申报失败！")
                    }
                })

            }
        }
    }
</script>